package com.example.tao_city.text1;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

/**
 * Created by TAO_CITY on 2018/1/16.
 */

public class Chaxun_bangka extends Fragment {
    private View mv;
    private Button button;
    private EditText text;


    @Override
    public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState) {
        mv=inflater.inflate(R.layout.chaxun_bangka,container,false);
        initbutton();
        return mv;
    }

    private void initbutton(){
        button=mv.findViewById(R.id.bangka_button);
        text=mv.findViewById(R.id.bangka_kahao);


        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String kahao= String.valueOf(text.getText());
                if(kahao.equals("12306")){
                   Intent int1=new Intent();
                   int1.setClass(mv.getContext(),Chaxun_Record.class);
                   startActivity(int1);
                }else {
                    Toast.makeText(mv.getContext(),"错误",Toast.LENGTH_SHORT).show();
                }
            }
        });
    }
}
